#ifndef TDMA_H
#define TDMA_H
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <iostream>
using namespace std;
#ifndef DBG_TDMA
#define DBG_TDMA 0
#endif
//solves the tridiagonal system of linear equations of the form
//[b d a]{x} = {c}
//where b is the lower diagonal, d is the main diagonal, a is the upper diagonal

//c is the RHS and x is the unknown vector
class tdma
{
   private:
      gsl_vector* x;
   
      gsl_vector* b;
      gsl_vector* d;
      gsl_vector* a;
      gsl_vector* c;
      gsl_matrix* SqMat;
      bool sqmatset;
      size_t n;   //size of vectors      
      void Algorithm( );
               
   public:         
      void Solve( gsl_vector* bInp, gsl_vector* dInp, gsl_vector* aInp, 
         gsl_vector* cInp );
      //tdma( gsl_matrix* sqmat, gsl_vector* cInp );
      tdma( );
      gsl_vector* GetX( );
      void Delete( );
      ~tdma( );         
};
   
#endif //TDMA_H
